/* TourOffColl.java
 * 
 * TourOffColl contains a collection of tourOffs.
 * class contains accessor methods to find/get a tourOff.
 * 
 * Greg Warner
 * Derek Dupuis
 * Michael Dixey
 * Alex Schwartz
 */
 
 
import java.util.*;


public class TourOffColl extends TreeMap< String, TourOff > implements CollectionIF<TourOff>
{
   public TourOffColl()
   {
      super();
   }
   

   //adds a tourOff
   //returns true if added correctly
   public boolean add( TourOff tOff )
   {
      if( ! this.containsKey( tOff.offeringName() ) )
      {
         this.put(tOff.offeringName(), tOff );
         return true;
      }
      else
      {
         return false;
      }    
      
   }
   
   //finds a tourOff based on string
   public boolean find( String s )
   {
      return this.containsKey(s);
   }
   
   //gets a tourOff based on string
   public TourOff get( String s )
   {
      return super.get( s );
   }
   
   //toString that prints all tour offerings in collection
   public String toString()
   {
      String s = "TOUR OFFERINGS:\n";
      Set t = this.keySet();
      
      Iterator iter = t.iterator();
      
      while( iter.hasNext() )
      {
         s = s + this.get(iter.next() ).toString() + '\n';
      }
      
      return s;
   }
}

 
 
 
 

